﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
namespace huimei
{
    public class NongyeNews
    {
        [Key]
        public string title { get; set; }
        public string content { get; set; }
        public string time { get; set; }
        public string from { get; set; }
    }
    public class NongyeNewsContext : DbContext
    {
         public DbSet<NongyeNews> newslist { get; set; }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(Program.conectinstring);
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<NongyeNews>().ToTable("NongyeNews");
        }
   }
        
        
        
    }
